﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YXShop.IDAL.Stocks;
using YXShop.DALFactory;

namespace YXShop.BLL.Stocks
{
    public class BarCode
    {
        private readonly IBarCode dal = DataAccess.CreateBarCode();
        public BarCode()
        { }
        #region DataBase Operation
        /// <summary>
        /// 添加一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(Model.Stocks.BarCode model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Update(Model.Stocks.BarCode model)
        {
            return dal.Update(model);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// <param name="id"></param>
        public void Delete(int id)
        {
            dal.Delete(id);
        }
        /// <summary>
        /// 删除多条数据
        /// </summary>
        /// <param name="ids"></param>
        public void DeleteAll(string ids)
        {
            dal.DeleteAll(ids);
        }
       
        #endregion

        #region DataBase Load
      
        public Model.Stocks.BarCode GetModelById(int id)
        {
            return dal.GetModelById(id);
        }
        public Model.Stocks.BarCode GetModelByBarCode(string barcode)
        {
            return dal.GetModelByBarCode(barcode);
        }
        /// <summary>
        /// 根据条件分页
        /// </summary>
        /// <param name="strWhere">为空 查所有</param>
        /// <returns></returns>
        public ChangeHope.DataBase.DataByPage GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        public List<Model.Stocks.BarCode> GetListBarCodeByWhere(string where)
        {
            return dal.GetListBarCodeByWhere(where);
        }
        public ChangeHope.DataBase.DataByPage GetList(string orderfield, int pagesize, string Conditions)
        {
            return dal.GetList(orderfield, pagesize, Conditions);
        }
        #endregion
    }
}
